<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY nbsp "&#160;">
  <!ENTITY deg "&#176;">
]>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/weather">
    <div  class="slm-layout-main">
      <!-- Header -->
      <div class="reverseBand">
        Weather in: <span style="font-weight:bold;"><xsl:value-of select="loc/dnam"></xsl:value-of></span> 
      </div>
      <!-- Current Day Info -->
      <table width="300px" border="0" cellSpacing="0" cellPadding="0" ID="Table1">
        <tr>
          <xsl:variable name="med-img-dir">http://image.weather.com/web/common/wxicons/31</xsl:variable>
          <xsl:variable name="img-ext">gif</xsl:variable>
          <xsl:variable name="iconnumber">
            <xsl:value-of select="cc/icon"></xsl:value-of>
          </xsl:variable>
          <td width="35%" align="center" valign="center">
            <img src="{$med-img-dir}/{$iconnumber}.{$img-ext}"></img>
          </td>
          <td width="65%" align="center" valign="center" style="FONT-SIZE: 22pt;
                    FONT-WEIGHT: bold">
            <xsl:value-of select="cc/tmp"></xsl:value-of>&deg;F
        </td>
        </tr>
        <tr>
          <td align="center" valign="center" style="FONT-SIZE: 9pt; COLOR: black; 
                    FONT-FAMILY: Verdana; HEIGHT: 33px">
            <xsl:value-of select="cc/t"></xsl:value-of>
          </td>
          <td align="center" valign="center" style="FONT-SIZE: 9pt; COLOR: black; 
                    FONT-FAMILY: Verdana; HEIGHT: 33px">
            Feels like
            <xsl:value-of select="cc/flik"></xsl:value-of>&deg;F
        </td>
        </tr>
      </table>
      <!-- Current Day More Info -->
      <table width="300px" border="0" cellSpacing="0" cellPadding="0" ID="Table2">
        <tr>
          <td width="10%"></td>
          <td width="40%" align="left" valign="center" style="FONT-SIZE: 9pt; COLOR: black; 
                      FONT-FAMILY: Verdana">
            UV Index:
          </td>
          <td width="50%" align="left" valign="center" style="FONT-SIZE: 9pt; COLOR: black; 
                      FONT-FAMILY: Verdana">
            <xsl:value-of select="cc/uv/i"></xsl:value-of>&nbsp;<xsl:value-of select="cc/uv/t"></xsl:value-of>
          </td>
        </tr>
        <tr>
          <td></td>
          <td align="left" valign="center" style="FONT-SIZE: 9pt; COLOR: black; 
                      FONT-FAMILY: Verdana">
            Dew Point:
          </td>
          <td align="left" valign="center" style="FONT-SIZE: 9pt; COLOR: black; 
                     FONT-FAMILY: Verdana">
            <xsl:value-of select="cc/dewp"></xsl:value-of>&deg;F
        </td>
        </tr>
        <tr>
          <td></td>
          <td align="left" valign="center" style="FONT-SIZE: 9pt; COLOR: black; 
                      FONT-FAMILY: Verdana">
            Humidity:
          </td>
          <td width="40%" align="left" valign="center" style="FONT-SIZE: 9pt; COLOR: black; 
                      FONT-FAMILY: Verdana">
            <xsl:value-of select="cc/hmid"></xsl:value-of>%
          </td>
        </tr>
        <tr>
          <td></td>
          <td align="left" valign="center" style="FONT-SIZE: 9pt; COLOR: black; 
                      FONT-FAMILY: Verdana">
            Visibility:
          </td>
          <td  align="left" valign="center" style="FONT-SIZE: 9pt; COLOR: black; 
                      FONT-FAMILY: Verdana">
            <xsl:value-of select="cc/vis"></xsl:value-of> miles
          </td>
        </tr>
        <tr>
          <td></td>
          <td align="left" valign="top" style="FONT-SIZE: 9pt; COLOR: black; 
                      FONT-FAMILY: Verdana">
            Pressure:
          </td>
          <td align="left" valign="top" style="FONT-SIZE: 9pt; COLOR: black; 
                      FONT-FAMILY: Verdana">
            <xsl:value-of select="cc/bar/r"></xsl:value-of> inches and
            <xsl:value-of select="cc/bar/d"></xsl:value-of>
          </td>
        </tr>
        <tr>
          <td></td>
          <td align="left" valign="top" style="FONT-SIZE: 9pt; COLOR: black; 
                     FONT-FAMILY: Verdana">
            Wind:
          </td>
          <td align="left" valign="top" style="FONT-SIZE: 9pt; COLOR: black; 
                      FONT-FAMILY: Verdana">
            From <xsl:value-of select="cc/wind/t"></xsl:value-of> at
            <xsl:value-of select="cc/wind/s"></xsl:value-of> mph
          </td>
        </tr>
      </table>
      <!-- Spacer Table -->
      <table width="300px" border="0" cellSpacing="0" cellPadding="0" >
        <tr height ="20px">
          <td>
          </td>
        </tr>
      </table>
      <!-- Multi-day forcast -->
      <table width="300px" border="0" cellSpacing="0" cellPadding="0" ID="Table3">
        <tr>
          <xsl:for-each select="dayf/day">
            <xsl:if test="@d > 0">
              <td width="42px" align="center" valign="top" style="FONT-SIZE: 7pt; COLOR: black; 
                          FONT-FAMILY: Verdana">
                <xsl:choose>
                  <xsl:when test="@t = 'Sunday'">
                    Sun.
                  </xsl:when>
                  <xsl:when test="@t = 'Monday'">
                    Mon.
                  </xsl:when>
                  <xsl:when test="@t = 'Tuesday'">
                    Tues.
                  </xsl:when>
                  <xsl:when test="@t = 'Wednesday'">
                    Wens.
                  </xsl:when>
                  <xsl:when test="@t = 'Thursday'">
                    Thurs.
                  </xsl:when>
                  <xsl:when test="@t = 'Friday'">
                    Fri.
                  </xsl:when>
                  <xsl:otherwise>
                    Sat.
                  </xsl:otherwise>
                </xsl:choose>
              </td>
            </xsl:if>
          </xsl:for-each>
        </tr>
        <tr>
          <xsl:for-each select="dayf/day">
            <xsl:if test="@d > 0">
              <td width="42px" align="center" valign="top" style="FONT-SIZE: 7pt; COLOR: black; 
                          FONT-FAMILY: Verdana">
                <xsl:value-of select="@dt"></xsl:value-of>
              </td>
            </xsl:if>
          </xsl:for-each>
        </tr>
        <tr>
          <xsl:variable name="small-img-dir">http://image.weather.com/web/common/wxicons/31</xsl:variable>
          <xsl:variable name="img-ext">png</xsl:variable>
          <xsl:for-each select="dayf/day">
            <xsl:if test="@d > 0">
              <xsl:variable name="iconnumber">
                <xsl:value-of select="part/icon"></xsl:value-of>
              </xsl:variable>
              <td width="42px" align="center" valign="center">
                <img border="1" src="{$small-img-dir}/{$iconnumber}.{$img-ext}"></img>
              </td>
            </xsl:if>
          </xsl:for-each>
        </tr>
        <tr>
          <xsl:for-each select="dayf/day">
            <xsl:if test="@d > 0">
              <td width="42px" align="center" valign="top" style="FONT-SIZE: 7pt; COLOR: black; 
                          FONT-FAMILY: Verdana">
                High:
                <xsl:value-of select="hi"></xsl:value-of>
              </td>
            </xsl:if>
          </xsl:for-each>
        </tr>
        <tr>
          <xsl:for-each select="dayf/day">
            <xsl:if test="@d > 0">
              <td width="42px" align="center" valign="top" style="FONT-SIZE: 7pt; COLOR: black; 
                          FONT-FAMILY: Verdana">
                Low:
                <xsl:value-of select="low"></xsl:value-of>
              </td>
            </xsl:if>
          </xsl:for-each>
        </tr>
        <tr>
          <xsl:for-each select="dayf/day">
            <xsl:if test="@d > 0">
              <td width="42px" align="center" valign="top" style="FONT-SIZE: 7pt; COLOR: black; 
                          FONT-FAMILY: Verdana">
                <xsl:value-of select="part/t"></xsl:value-of>
              </td>
            </xsl:if>
          </xsl:for-each>
        </tr>
      </table>
      <!-- Spacer Table -->
      <table width="300px" border="0" cellSpacing="0" cellPadding="0" >
        <tr height ="20px">
          <td>
          </td>
        </tr>
      </table>
      <!-- Provided By Weather.com -->
      <table width="300px" border="0" cellSpacing="0" cellPadding="4" ID="Table4">
        <tr>
          <xsl:variable name="twclink">
            http://www.weather.com/?prod=xoap
          </xsl:variable>
          <td width="20%" align="center" valign="top" style="FONT-SIZE: 7pt; COLOR: black;
                      FONT-FAMILY: Verdana">
            Weather data provided by<a href="{$twclink}" target="_none"> weather.com
            </a>
          </td>
        </tr>
      </table>
    </div>
  </xsl:template>
</xsl:stylesheet>